<template>
    <Modal
        v-model="modal"
        width="1600px"
        title="优惠券选择"
        :loading="loading"
        @on-ok="asyncOK">
        <IndexSelect v-if="modal" ref="indexSelect" :selectedMember="true" :selectedList="selectedList"/>
    </Modal>
</template>
<script>
    import IndexSelect from '../coupon-select.vue'

    export default {
        components: {
            IndexSelect
        },
        data () {
            return {
                modal: false,
                loading: true,
                selectedList: [],
            }
        },
        methods: {
            show(selectedList = []) {
                this.selectedList = selectedList
                this.$nextTick(()=>{
                    this.modal = true
                })
            },
            asyncOK () {
                let selectData = this.$refs.indexSelect.selectList
                this.$emit('dataSelect', selectData)
                this.modal = false;
            }
        }
    }
</script>
